def prefix(s1,s2):
    x=0#记录相同下标
    while x <len(s1) and x<len(s2):
        if s1[x]==s2[x]:
            x+=1
        else:
            break#下标停止处
    if x-1>1:
        print(s1[:x])
    else:
        print("No common prefix")

def main():
    s1=input()
    s2=input()
    prefix(s1,s2)
main()